package com.star.batchhandler.demo;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class TestLock {
	private static Lock lock = new ReentrantLock();

	public static void main(String[] args) {
		new Thread(new Runnable() {

			@Override
			public void run() {
				lock.lock();
				lock.lock();
				lock.unlock();
			}
		}).start();

		new Thread(new Runnable() {

			@Override
			public void run() {
				lock.lock();
				lock.lock();
				lock.unlock();
				lock.unlock();
				lock.lock();
				lock.unlock();
			}
		}).start();
	}

}
